module.exports = {
	onShow() {
		let userInfo = uni.getStorageSync('userInfo')
		let userId = uni.getStorageSync('userInfo').id
		let pages = getCurrentPages()
		// console.log('pages[len - 1]', pages[pages.length - 1]);

		if (pages.length >= 1) {
			let urls = (pages[pages.length - 1]).route
			url = urls + '?idd=' + userId
			if ('pages/shop/detail' == urls) {
				url = urls + '?id=' + pages[pages.length - 1].options.id + '&idd=' + userId
				// console.log('[成功]');
			} else {
				// console.log('[失败]');
			}
			this.$x.pageRouter = url
			// console.log('[分享自己id路径]',url);
			if (this.$x.pageRouter) {
				this.$x.mpShare = {
					title: '芒果乐游团', // 分享标题
					path: this.$x.pageRouter, // 默认为当前页面路径
					imageUrl: '' // 默认为当前页面的截图
				}
			}
			return;
		}
	},

	onLoad(option) {
		if (option.idd) {
			uni.setStorageSync('idd', option.idd)
		}
		// console.log('[穿过来的路径]', option);
	},
	// 分享到好友
	onShareAppMessage(el) {
		return this.$x.mpShare
	},
	// 分享到朋友圈
	onShareTimeline() {
		return this.$x.mpShare
	},
}
